#! /bin/bash

np=$1;
npstride=$2;
if  [[ $npstride != 1 ]]
then
    corenum[0]=1
    for i in `seq  $npstride $npstride $np`
    do
        corenum[$(($i/$npstride))]=$i;
        #echo ${corenum[$(($i/$npstride))]} $i
    done
else
    for i in `seq  1 $np`
    do
        corenum[$(($i-1))]=$i;
        #echo ${corenum[$(($i/$npstride))]} $i
    done
fi
total=30
a=24;
b=24;
for exe in 2d-9p
do
    rm ./$exe.txt
    for i in `seq 4 2 100`;
    do
        ../$exe/exe-$exe $i $i 2000 >> ./$exe.txt 
        echo  $i >> ./2d-9p.cpulist
    done
    for i in `seq 100 10 250`;
    do
        ../$exe/exe-$exe $i $i 2000 >> ./$exe.txt 
        echo  $i >> ./2d-9p.cpulist
    done
    for i in `seq 300 50 1000`;
    do
        ../$exe/exe-$exe $i $i 2000 >> ./$exe.txt 
        echo  $i >> ./2d-9p.cpulist
    done
    for i in `seq 2000 1000 6000`;
    do
        ../$exe/exe-$exe $i $i 2000 >> ./$exe.txt 
        echo  $i >> ./2d-9p.cpulist
    done
done


echo -e "np\tGStencils" > ./2d-9p.data.txt
cat ./2d-9p.txt |awk -F "= " '{print $NF}'| paste 2d-9p.cpulist -  | awk '{print $1 "\t" $2 }' >>  ./2d-9p.data.txt
rm ./2d-9p.cpulist
rm ./2d-9p.txt